# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-hatch-openzim-bootstrap
pkgver=0.1.0
pkgrel=0
pkgdesc="Bootstrap for py3-hatch-plugin"
url="https://github.com/openzim/hatch-openzim/"
arch="noarch"
license="GPL-3.0-or-later"
makedepends="py3-gpep517 py3-hatchling py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-pytest-cov"
subpackages="$pkgname-pyc"
source="py3-hatch-openzim-$pkgver.tar.gz::https://github.com/openzim/hatch-openzim/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/hatch-openzim-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# it is expected that test_metadata_nominal will fail
	# (git tarball in use),
	# reported upstream:
	# https://github.com/openzim/hatch-openzim/issues/13
	.testenv/bin/python3 -m pytest \
		-k "not test_metadata_nominal"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
5d7a0c75de7517c2e1f9649fd04d43577373f28dfcaa12dc15788e045226ef93f1cb7346a806169c5131749970fbe45a582006189c47daa60d9769cb2fab15db  py3-hatch-openzim-0.1.0.tar.gz
"
